package com.miao.hong.fang.webservice.standaloneTest;

import java.io.IOException;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

import org.apache.ws.security.WSPasswordCallback;

public class PWCBHandler_Server implements CallbackHandler {

	public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
		
		for(int i=0; i<callbacks.length; i++) {
			System.out.println("abcdddddddddddd" + callbacks[i]);
			
			WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[i];
			
			System.out.println("Username=" + pwcb.getIdentifier());
			System.out.println("password=" + pwcb.getPassword());
			
			//pwcb.setIdentifier("gao");
			//pwcb.setPassword("shuai");
			
			//throw new IOException("wrong user");
		}
	}

}
